<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:set var="ctx" scope="page" value="${request.contextPath}" />
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE  >
<html >
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0,viewport-fit=cover">
    <title>报修历史</title>
    <link rel="stylesheet" type="text/css" href="${ctx}/static/weui/1.1.2/weui-for-work.min.css"/>
    <script type="text/javascript" src="${ctx}/static/jquery/jquery-1.8.3.min.js"></script>
    <%--<script type="text/javascript" src="https://res.wx.qq.com/open/libs/weuijs/1.1.2/weui.min.js"></script>--%>
    <!-- 企业微信的JS-SDK -->
    <%--<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>--%>
</head>
<body style="background-color: #f8f8f8" >
<div class="page">
<div class="page__bd">
    <input type="hidden" name="userId" id="userId" value="${userId}"/>
<c:forEach items="${repaireInfos}" var="repaireInfo">
    <div class="weui-form-preview">
        <div class="weui-form-preview__bd">
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">报修类型</label>
                <span class="weui-form-preview__value"><c:out value="${repaireInfo.machineType}"/></span>
            </div>
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">分类</label>
                <span class="weui-form-preview__value"><c:out value="${repaireInfo.repaireSubject}"/></span>
            </div>
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">报修地址</label>
                <span class="weui-form-preview__value"><c:out value="${repaireInfo.address}"/></span>
            </div>
            <%--<div class="weui-form-preview__item">
                <label class="weui-form-preview__label">其他地址</label>
                <span class="weui-form-preview__value"><c:out value="${repaireInfo.otherAddress}"/></span>
            </div>--%>
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">备注</label>
                <span class="weui-form-preview__value"><c:out value="${repaireInfo.description}"/></span>
            </div>
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">创建时间</label>
                <span class="weui-form-preview__value"><fmt:formatDate pattern="yyyy-MM-dd HH:mm" value="${repaireInfo.createTime}" type="both"/></span>
            </div>
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">状态</label>
                <span class="weui-form-preview__value"><c:out value="${repaireInfo.status}"/></span>
            </div>
        </div>
        <c:if test="${repaireInfo.status=='服务完成待评价'}">
        <div class="weui-form-preview__ft">
            <a class="weui-form-preview__btn weui-form-preview__btn_primary" href="javascript:toCustomerSatisfaction(${repaireInfo.id})">满意度调查</a>
        </div>
        </c:if>
    </div>
    <br>
</c:forEach>
</div>
    <c:if test="${empty repaireInfos}">

        <div class="weui-msg">
            <div class="weui-msg__icon-area"><i class="weui-icon-waiting weui-icon_msg"></i></div>
            <div class="weui-msg__text-area">
                <h2 class="weui-msg__title">没有报修信息了</h2>
            </div>
        </div>
    </c:if>
</div>
<script>

    $(function () {
        var needRefresh = sessionStorage.getItem("need-refresh");
        if(needRefresh){
            sessionStorage.removeItem("need-refresh");
            location.reload();
        }
    });
    var checkSubmitFlg = true;
    function toCustomerSatisfaction(id) {
        if (checkSubmitFlg == true) {
            checkSubmitFlg = false;
            location.href = '${ctx}/weixin/to_customer_satisfaction/'+id;
        }
    }
</script>
</body>
</html>
